﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Otonomos.World;

namespace Test.Otonomos.World
{
    [TestClass]
    public class TestSimpleWall3D
    {
        [TestMethod]
        public void CreateWall()
        {
            var wall = new SimpleWall3D(new Point3D(0, 0, 0), new Point3D(100, 100, 100), WallType.SingleRight);
            var x = wall.FirstPoint == Point3D.Origin;
            Assert.IsTrue(x);
            Assert.AreEqual(wall.SecondPoint, new Point3D(100, 100, 100));
            Assert.AreEqual(wall.WallType, WallType.SingleRight);
            Assert.AreEqual(wall.Height, 100.0);
            Assert.AreEqual(wall.Length, Math.Sqrt(20000.0));
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void CreateWallWithNoHeight()
        {
            var wall = new SimpleWall3D(new Point3D(0, 0, 0), new Point3D(100, 100, 0), WallType.DoubleSided);
            Assert.Fail("wall creation should fail for wall {0}", wall);
        }
        
        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void CreateWallWithNegativeHeight()
        {
            var wall = new SimpleWall3D(new Point3D(0, 0, 0), new Point3D(100, 100, -100), WallType.DoubleSided);
            Assert.Fail("wall creation should fail for wall {0}", wall);
        }


        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void CreateWallWithNoLength()
        {
            var wall = new SimpleWall3D(new Point3D(0, 0, 0), new Point3D(0, 0, 100), WallType.DoubleSided);
            Assert.Fail("wall creation should fail for wall {0}", wall);
        }
    }
}
